/**
 * Basic method Builder used to differentiate public & private variable based on their name.
 * All methods are bound to their object (this will always be the objects "this", even in a event listener)
 *
 * @namespace Archetype.methodBuilders.public_private
 */
$N("Archetype.methodBuilders.public_private", {
	regexp:".*",
	/**
	 * Acts on the Archetype.Component definition method methodName (that matches ".*" regexp)
	 *
	 * @param {Archetype.ComponentDefinition} component
	 * @param {Function} methodName
	 */
	build: function (/*Archetype.ComponentDefinition*/component, /*Function*/methodName){
		if (methodName.match("^[^_].*")) {
			component[methodName] = component._private[methodName] = function(){
					return this._definition[methodName].apply(this, arguments);
			}.bind(component._private);
		}
		else {
			var newMethodName = methodName.replace(/^_/, "");
			component._private[newMethodName] = function(){
					return this._definition[methodName].apply(this, arguments);
			}.bind(component._private);
		}
	}
});